<%--
  Created by IntelliJ IDEA.
  User: 29276
  Date: 2021/8/28
  Time: 7:24
  To change this template use File | Settings | File Templates.
--%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    //http://localhost:8080/01_sxtoa_war_exploded/
%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <base href="<%=basePath%>"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#btn").click(function () {
                const reqData = {
                    empId:$("#empId").val(),
                    email:$("#email").val(),
                    methodName:"emailCode"
                }
                console.log(reqData);
                $.post("forgetPwdServlet", reqData, function (data) {
                    if (eval(data)) {
                        alert("发送成功！");
                    }
                    else {
                        alert("发送失败");
                    }
                })
            })

            $("#submit").click(function () {
                const reqData = {
                    emailCode:$("#emailCode").val(),
                    methodName:"emailCodeConfirm"
                }
                console.log(reqData);
                $.post("forgetPwdServlet", reqData, function (data) {
                    if (eval(data)) {
                        alert("验证成功！");
                        //跳转页面
                        window.location.assign("forgetPwd.jsp");
                    }
                    else {
                        alert("验证失败");
                    }
                })
            })
        })
    </script>
</head>

<body>

<div class="formbody">

    <div class="formtitle"><span>忘记密码</span></div>

    <ul class="forminfo">
        <li><label>用户名</label><input id="empId" name="" type="text" class="dfinput" /><i></i></li>
        <li><label>邮箱</label><input id="email" name="" type="text" class="dfinput" /><i></i></li>
        <li><label>&nbsp;</label><input id="btn" name="" type="button" class="btn" value="确认发送"/></li>
        <li><label>验证码</label><input id="emailCode" name="" type="text" class="dfinput" /><i></i></li>
        <li><label>&nbsp;</label><input id="submit" type="button" class="btn" value="下一步"/></li>
    </ul>


</div>


</body>

</html>

